home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Online / AutoPage / AutoPage.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-02-01  |  3.4 KB  |  17 lines

  1. /* $VER: AutoPage.rexx v0.6, 01 Feb 1998
  2. ** Program to automatically collect html pages specified in a list
  3. ** Requires: HTTPJ 2.00 by Piergiorgio Ghezzo, rexxsupport.library
  4. ** Limitations: Only http protocol, FULL file name & path <- IMPORTANT!
  5. ** Author: Arne Seime <aseime@iname.com>
  6. ** Sitelist is arranged like this: URL IMAGES SHOW
  7. ** CHANGES SINCE 0.4:
  8. ** - Added progdir so script can be run from any path, not just current dir.
  9. ** - Fixed a time convertion bug that occured if a disk file was dated
  10. **   xx:00:xx. Strange I didn't discovered it before :)
  11. ** - The result page are temporary stored in ram to keep disk fragmentation down.
  12. ** - sitelist.txt was not closed when exiting.
  13. ** - Added possibility to recieve several pages at a time.
  14. ** - Added a prefs file - a few more options.
  15. */
  16. SIGNAL ON BREAK_C;options results;call addlib('rexxsupport.library',0,-30);if open(prefs,"env:autopage.prefs") then;do;savedir = word(readln(prefs),1);progdir = word(readln(prefs),1);max_con = word(readln(prefs),1);loop_delay = word(readln(prefs),1);buffers = word(readln(prefs),1);call setclip(ap_buffers,buffers);call setclip(ap_savedir,savedir);call setclip(ap_progdir,progdir);call close(prefs);end;else;do;Say "Unable to open prefs file.";Say "If you don't have one, type the following into your favourite text editor:";Say "<savedir>          /* Directory to save pages in*/";Say "<progdir>          /* Directory where program files are located */";Say "<connections>      /* Number of connections to run at the same time */";Say "<loop delay>       /* Time in 1/50 sec. Time to wait for ready connection */";Say "<buffers>          /* Download buffer in kb each connection */";Exit;end;id = 0;do id=1 to max_con;address command "run >NIL: rx httpj.rexx" id;call setclip("HTTPJ." || id,0);address command 'waitforport' "HTTPJ." || id;end;id = 0;line = 0;if ~exists(progdir || sitelist.txt) then;do;Say 'Unable to open sitelist.txt. Exiting.';Exit;end;ok = open(list,progdir || 'sitelist.txt',R);do while ~eof(list);images = '';line = line + 1;id = id+1;rcd = readln(list);if rcd = '' then break;do r=1;if getclip("HTTPJ." || id) = 0 then;do;httpj_address = "HTTPJ." || id;address value httpj_address;line rcd;id = 0;leave r;end;id = id+1;if id > max_con then id = 1;call delay(loop_delay);end;end;do f=1 to max_con;httpj_address = "HTTPJ." || f;address value httpj_address;close;end;ok = open(outpage,'T:_autopage_temp_index.html',W);call writeln(outpage,'<HTML><HEAD><TITLE>Pages collected on' date() || ',' time() '</TITLE></HEAD><!-- Page made by AutoPage.rexx, © Arne Seime <aseime@iname.com> 1998 --><BODY BGCOLOR='WHITE'><BR><CENTER><H2>Pages collected on ' date()', 'time()':</H2><BR><TABLE CELLSPACING=5><TR BGCOLOR='RED'><TD>STATUS</TD><TD>ADDRESS</TD><TD>DATE</TD><TD>TIME</TD></TR>');do o = 1 to (line-1);if open(temp,"T:autopage_temp." || o) then;do;data = readln(temp);call writeln(outpage,data);call close(temp);end;end;call writeln(outpage,'<BR></BODY></HTML>');call close(outpage);call close(list);address command 'copy T:_autopage_temp_index.html to' savedir || 'index.html QUIET';if exists('T:_autopage_temp_index.html') then address command 'delete T:_autopage_temp_index.html QUIET';if exists('T:_httpj_temp.1') then address command 'delete >NIL: T:_httpj_temp.#?';if exists('T:autopage_temp.1') then address command 'delete >NIL: T:autopage_temp.#?';exit;BREAK_C:;do f=1 to max_con;if show(p,"HTTPJ." || f) then call closeport("HTTPJ." || f);say "PORT HTTPJ." || f "closed.";end;
  17.